package picture;

import javax.swing.*;
import java.awt.*;
//设计面板背景
public class Background extends JPanel {
    private Image background;
    public Background(String path) {
        ImageIcon icon = new ImageIcon(getClass().getResource("/" + path));
        this.background = icon.getImage();
    }
    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        if(background != null) {
            g.drawImage(background, 0, 0, this.getWidth(), this.getHeight(), this);
        }
    }
}
